package com.zp.qualitypractice.fragment;

import android.os.Bundle;
import android.view.View;

/**
 * Created by izp on 2017/6/26.
 */

public class DemoOfABase extends ABaseFragment implements View.OnClickListener{
    private static final String ARG1 = "arg1";
    public static DemoOfABase newInstance(String cityName) {
        Bundle args = new Bundle();
        args.putString(cityName,ARG1);
        DemoOfABase fragment = new DemoOfABase();
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        if (bundle != null) {
            String city = bundle.getString(ARG1);
        }
    }
    @Override
    protected int getLayoutId() {
        return 0;
    }

    @Override
    protected void afterCreate(Bundle savedInstanceState) {

    }
    /**
     * 交给宿主Activity处理，如果它希望处理
     */
    @Override
    public void onClick(View v)
    {
        if (getActivity() instanceof DemoOfBaseEventListener) {
            ((DemoOfBaseEventListener) getActivity()).onEvent();
        }
    }

    /**
     * 设置按钮点击的回调
     * @author zhy
     *
     */
    public interface DemoOfBaseEventListener {
        void onEvent();
    }
}
